package com.wenan.ui.reports
{
	import com.wenan.AppGlobal;
	import com.wenan.data.ParameterCollection;
	import com.wenan.ui.controls.charts.Splashes;
	
	import mx.collections.ArrayCollection;
	import mx.containers.Box;
	import mx.controls.Alert;
	import mx.core.UIComponent;
	import mx.rpc.events.ResultEvent;

	/**
	 * 散点图报表信息
	 * <br><br>图标横向显示面积属性，纵向显示数据属性。数据属性可以复选是否显示。
	 */
	public class HashpointReportInfo extends ReportInfo
	{
		private var splashes:Splashes;
		private var _xField:String;
		private var _yFields:Array;
		
		public function HashpointReportInfo()
		{
			super();
		}

		public override function get title():String
		{
			return "散点图";
		}
		
		public override function get xField():String
		{
			return _xField;
		}

		public override function set xField(value:String):void
		{
			_xField = value;
		}

		public override function get yFields():Array
		{
			return _yFields;
		}

		public override function set yFields(value:Array):void
		{
			_yFields = value;
		}
		
		public override function createReportPanel():UIComponent {
			splashes = new Splashes();
			
			var chartSty:ParameterCollection = reportData.reportStyle;
			splashes.dataProvider = reportData.dataProvider as ArrayCollection;
			if (chartSty && chartSty.length > 0)
			{
				var charts:ParameterCollection =  chartSty.getObj("散点图") as ParameterCollection;
				if (!charts)
				{
					Alert.show("找不到此报表的渲染信息！");
					return new Box();
				}
				splashes.xField = (charts.getObj("yDefaultFields") as ArrayCollection)[0].propertyName;
				splashes.yField = (charts.getObj("yDefaultFields") as ArrayCollection)[1].propertyName;
				
				var balloonName:String = charts.getObj("reportStyle").balloonText;
				var balloonValue:String = splashes.xField;
				splashes.balloonText = "广场:[[name]] " + balloonName+":[[" +balloonValue + "]]";
				splashes.labelText = "[[name]]";
				splashes.titleName = charts.getObj("reportStyle").title;
				splashes.xHeading.title = charts.getObj("reportStyle").axisX;
				splashes.yHeading.title = charts.getObj("reportStyle").axisY;
			}
		
			return splashes.createReportPanel();
		}
	}
}